//导入封装好的axios
import request from "./request"
import qs from 'qs'
//定义一个请求精品店数据  export导出 
//定义变量名 const jingpinapi
//()=>以函数返回值的方式,避免自动请求多次
//request前面封装好的axios,.get("请求的具体名称")发送请求,然后赋值给jingpinapi
//精品推荐
export const jingpinapi = () => request.get("/products/recommend")
//精品兑换
export const HotAPI = () => request.get("/products/hot")
export const logincode = (val) => request.post("/sendSMS", qs.stringify(val))
export const phoneloginAPI = (val) => request.post("/phoneRegin", qs.stringify(val))
//微信登陆
export const WeiXinLoginAPI = (params) => request.post("/wechatUsers/PCLogin",
    qs.stringify(params))
//微信绑定
export const bangdingAPI = (params) => request.post("/wechatUsers/binding",
    qs.stringify(params))
// 获取登录用户信息
export const UserProfilesAPI = () => request.get("/shop/userProfiles");
//商品详情/products/{id}
export const GoodDetailsAPI = (id) => request.get(`products/${id}`);
//添加到购物车/shop/carts/add
export const CartsAddAPI = (params) => request.post("/shop/carts/add",
    qs.stringify(params))
//全部商品/products
export const GoodsSearchApi = (params) => request.get("/products", { params });
//查看购物车/shop/carts
export const CartsAPI = () => request.get("/shop/carts");